package cn.iocoder.yudao.module.pay.bank.convert;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.thirdparty.verify.bankcard.BankVerifyResult;
import cn.iocoder.yudao.module.pay.bank.bo.PayBankBO;
import cn.iocoder.yudao.module.pay.bank.dal.dataobject.PayBankDO;
import cn.iocoder.yudao.module.pay.bank.vo.AppPayBankCreateReqVO;
import cn.iocoder.yudao.module.pay.bank.vo.AppPayBankRespVO;
import cn.iocoder.yudao.module.pay.bank.vo.PayBankCardRespVO;
import cn.iocoder.yudao.module.pay.bank.vo.PayBankRespVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * 银行卡信息 Convert
 *
 * @author 山野羡民
 */
@Mapper
public interface BankConvert {

    BankConvert INSTANCE = Mappers.getMapper(BankConvert.class);

    @Mapping(target = "cardCode", ignore = true)
    @Mapping(target = "cardType", ignore = true)
    @Mapping(target = "cardName", ignore = true)
    PayBankBO convert(AppPayBankCreateReqVO bean);

    @Mapping(target = "remark", ignore = true)
    @Mapping(target = "userId", ignore = true)
    @Mapping(target = "status", ignore = true)
    @Mapping(target = "id", ignore = true)
    @Mapping(target = "cardMobile", source = "mobile")
    PayBankDO convert(PayBankBO bean);

    PayBankRespVO convert(PayBankDO bean);

    AppPayBankRespVO convert2(PayBankDO bean);

    @Mapping(target = "cardName", ignore = true)
    @Mapping(target = "cardType", source = "type")
    @Mapping(target = "cardNo", source = "key")
    @Mapping(target = "cardCode", source = "bank")
    @Mapping(target = "validated", source = "validated")
    PayBankCardRespVO convert(BankVerifyResult bean);

    AppPayBankRespVO convert(PayBankRespVO bean);

    List<AppPayBankRespVO> convertList(List<PayBankDO> list);

    PageResult<PayBankRespVO> convertPage(PageResult<PayBankDO> page);

}
